# -*- coding: utf-8 -*-
# Author: xiantingDeng
# File: transmit_data_ls.py
# Time: 11:32
import sys
import os

sys.path.insert(1, os.path.dirname(os.path.dirname(os.path.abspath(""))))
from common.utils.file_util import get_data_yaml, \
    get_data_json
from common.utils.read_util import OperationYaml, \
    OperationJson


class GeneratingCaseData():
    def __init__(self, filename, key):
        self.key = key
        self.filename = filename
        file = get_data_json("{}.json".format(self.filename))
        self.config = OperationJson().get_own_json(filename=file)

    def get_yaml_case(self):
        '''
        生成case需要的数据
        :param key 需要读取的key值
        :return: 以列表形式返回
        '''
        list = []
        file = get_data_yaml("{}.yml".format(self.filename))
        config = OperationYaml(file).get_own_yaml().get(self.key)
        return config
        # for i in config:
        #     list.append(i)
        # return list


if __name__ == '__main__':
    print(GeneratingCaseData("promoter_test", "test_promoter_submit").get_yaml_case())
